package com.supermap.dataservice.cloud.circum;

import com.alibaba.dubbo.config.annotation.Service;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.advisoryinfo.entity.AdvComment;
import com.supermap.dubbo.api.cloud.circum.CropsHospitalService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author aqua
 * @description
 * @date 2018年11月19 下午 8:41
 * @email 1301584033@qq.com
 */
@Service
public class CropsHospitalServiceImpl implements CropsHospitalService {
    @Resource
    private CropsHospitalMapper cropsHospitalMapper;

    @Override
    public JSONUtil getPageCropsHospitalByAreaCodeOrkeyName(String areaCode, String keyName,Integer pageNum,Integer pageSize) {
        pageNum=(pageNum-1)*pageSize;
        try{
            return  new JSONUtil().setData(cropsHospitalMapper.
                    getPageCropsHospitalByAreaCodeOrkeyName(areaCode,keyName,pageNum,pageSize)).
                    setCountSum(cropsHospitalMapper.getPageCropsHospitalByAreaCodeOrkeyNameCount(areaCode,keyName));
        }catch (Exception e){
            e.printStackTrace();
            return new JSONUtil().setCode(100).setIsSuccess(false).setMsg("查询失败");
        }
    }
}
